<template>
  <div style="height: 100%; position: fixed; z-index: 999; top: 0; width: 100%">
    <x-header :left-options="{backText: '',preventGoBack:true}" @on-click-back="backhome">BIM模型
      <!-- <div class="sure-btn"   slot="right"  @click="confirm" v-if="this.bindInfo">确定</div> -->
    </x-header>
    <div class="container" style="height: calc(100% - 56px)">
      <iframe :src="src" frameborder="0" height="100%" width="100%"></iframe>
    </div>
    <router-view></router-view>
  </div>
</template>
<script>
export default {
  name: 'bimInfo',
  mounted() {
    this.getSrc()
  },
  data() {
    return {
    }
  },
  // beforeRouteLeave(to,from,next){
  //   to.meta.keepAlive = true;
  //   next();
  // },
  methods: {
    backhome(){
      this.$router.push({
        path : '/projectInfo/projectInfo',
        name : 'projectInfo',
        params : {
          item : this.$route.params.obj
        }
      })
    },
    confirm() {
      var bindState;
	    var storage = window.localStorage;
	    var FixJSON = '{"_method":"PMQUALITY_QUALITYCHECK.checkBind2",'+
                    '"_param":{'+
                    '"FormGUID":"'+this.bindInfo.GUID+'"}}';
      this.$ajax({
          method: 'post',
          url: this.COMMON_URL,
          data: {
            FixJSON
          }
        }).then((res) => {
          console.log(res)
          if(res.data.num == '1'){
            bindState='已绑定';
          }else{
            bindState='未绑定';
          }
          this.$store.commit('SET_BIND_INFO', {bindState, bindGUID: localStorage.selectedElementId})
          setTimeout(() => {
            this.$router.go(-1)
          }, 200);
        }).catch(err => {
          console.log(err)
        })
    },
    getSrc() {
      // if
    }
  },
  computed: {
    row() {//页面中使用row来指代当前记录
      return this.$store.state.currentRow;
    },
    bindInfo() {
      return this.$route.params.item
    },
    src() {
      let src = "./static/BimViz/examples/bim1.html?_pkValue=" + this.bindInfo.DATA
      return src
    },
  }
}
</script>
<style>
/* .transition-view /deep/ .vux-header .vux-header-title {
    color: #262A34;
} */
.container{
  overflow: auto;
  width: 100%;
  height: 100%;
  position: relative;
}
  .sure-btn{
    padding: 0 20px;
    margin: 0px;
    background-color: transparent;
    color: #3D66FF;
    font-size: 16px;

  }
</style>
